package day19;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Vector;

public class TestThreasSecurity {
	public static void main(String[] args) {
		StringBuffer s ;
		StringBuilder s1;
		Vector v;
		ArrayList a;
		Hashtable h;
		HashMap hm;
		
		OtherList ol = new OtherList();
		ol.add("aaa");
		ol.add("bbb");
		String ss = (String) ol.get(1);
		Thread t1 = new MySercurityThread();
		Thread t2 = new MySercurityThread();
		Thread t3 = new MySercurityThread();
		t1.start();
		t2.start();
		t3.start();
	}
}

class OtherList{
	private Object[] os = new Object[10];
	private int size;//2
	
	public synchronized void add(Object o){
		os[size] = o;//----sleep
		size++;
	}
	
	public synchronized Object get(int at){//2
		if(at>=size){//2
			return null;
		}
		return os[at];
	}
	
	public synchronized int size(){
		return size;
	}
	
}

class MySercurityThread extends Thread{
	public void run(){
		HashMap hm = new HashMap();
		
	}
}




